#!/usr/bin/python
# -*- coding: UTF-8 -*-

import pymysql

coon = pymysql.connect(
    host = '49.234.81.253',user = 'root',passwd = 'liuyanjie',
    port = 3306,db = 'rdshare',charset = 'utf8'
)
cur = coon.cursor()  #建立游标
cur.execute("select * from MFwanzheng")  #查询数据
res = cur.fetchall()    #获取结果

#duqu
with open("./darknet/MFwanzheng.txt") as f:
    i=1
    line = f.readline()
    while line:
    	sql = "insert into MFwanzheng(context,frame_id) VALUE ('%s',%s);"%(line,i)
    	cur.execute(sql)
    	coon.commit()
    	i=i+1
    	line = f.readline()



cur.close()     #关闭游标
coon.close()    #关闭连接
